﻿<%@ Page Language="C#" MasterPageFile="~/Alumini/ALM-Menu.master" AutoEventWireup="true" CodeFile="ALM-RFCompose.aspx.cs" Inherits="RFCompose" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headSubMaster" Runat="Server">
<link rel="stylesheet" type="text/css" href="css/communication.css" />
<script type="text/javascript">
    function validate() {
        var txtto = document.getElementById('<%= txtToList.ClientID %>').value;
        var txtsubject = document.getElementById('<%= txtSubject.ClientID %>').value;
        var body = document.getElementById('<%= txtbody.ClientID %>').innerHTML;
        if (txtto == '') {
            alert('Please specify at least one recipient in the TO: field.');
            return false;
        }
        if (txtsubject == '') {
            var r = confirm("This email does not have any subject. Send anyway?.");
            if (r == true) {
                return true;
            }
            else {
                return false;
            }
        }
    }

    function createButton() {
        return '  <input class="remove" type="button" value="remove" onclick = "RemoveTextBox(this)" /></label>'
    }

    function createLabel() {
        return '<label class="fileupload" style="font-style:bold;width:90px">Attachment:</label><label>'
    }
    function CreateFileupload() {
        var file = document.createElement("input");
        file.className = "bros";
        file.setAttribute("type", "file");
        file.setAttribute("id", "file");
        file.setAttribute("name", "attachment");
        file.setAttribute("style", "visibility:visible;");
        return file;
    }
    function AddTextBox() {
        var div = document.createElement('p');
        div.setAttribute("class", "fileupload");
        div.innerHTML = createLabel();
        div.appendChild(CreateFileupload());
        div.innerHTML += createButton();
        document.getElementById("moreUploads").appendChild(div);

    }

    function RemoveTextBox(div) {
        document.getElementById("moreUploads").removeChild(div.parentNode);

    }


</script>
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_SubMaster" Runat="Server">

    <div id="page">
<div class="left-btn">
<p><input type="button" value="compose" onclick="page('ALM-Compose.aspx');" /></p>
<p><input type="button" value="inbox" onclick="page('ALM-InboxMessageList.aspx');" /></p>
<p><input type="button" value="sent"  onclick="page('ALM-SentMessages.aspx');"/></p>
    
</div>

<div class="right">
<p style="margin-bottom:20px;"> 
    <asp:Button ID="btnsendmsg" runat="server" Text="send"  CssClass="btnsendmsg" OnClientClick="return validate();"
        onclick="btnsendmsg_Click" />
</p>
<div class="mail-detail">
<div class="compose-to" id="moreUploads">

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
<p><label>to:</label> <label> <asp:TextBox ID="txtToList" runat="server" ReadOnly="true" TextMode="MultiLine"></asp:TextBox>
<img src="img/plus-icon.gif"  onclick="$find('ModalPopupExtender1').show();" alt=""/>
</label></p>
<p><label>cc:</label> <label> <asp:TextBox ID="txtCc" runat="server" ReadOnly="true" TextMode="MultiLine"></asp:TextBox>
<img src="img/plus-icon.gif"  onclick="$find('ModalPopupExtender1').show();" alt=""/>
</label></p>
  
<asp:button id="Button1" runat="server" text="btnAddUsers"  style="display:none"  />
      <asp:Panel id="Panel1" runat="server" style="display: none;" CssClass="popupConfirmation">
            <div class="popup_Container">
                <div class="popup_Titlebar" id="PopupHeader">
                    <div class="TitlebarLeft">Select Contacts</div>
                    <div class="TitlebarRight"></div>
                </div>
                <div class="popup_Body">
                <div >
                 <p style="padding-left:10px">To:</p> 
                   <asp:ListView ID="lstUsergroups" runat="server" ItemPlaceholderID="itemPlaceholder">
    <LayoutTemplate>
        <asp:CheckBox ID="chkuserAll" runat="server" AutoPostBack="true" OnCheckedChanged="chkuserAll_CheckedChanged"/>
        Check All<br />
        <hr />
        <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
    </LayoutTemplate>
    <ItemTemplate>
        <table border="0" cellspacing="1" class="displaysmall stylized" cellpadding="0">
            <tr>
                <td  colspan="3">
                    <asp:CheckBox ID="chkUser" runat="server" Text='<%#Eval("UserName")%>'  />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                <td style="width:20px">
                    <asp:Label ID="lblUserID" runat="server" Text='<%#Eval("UserID")%>' Visible="false"></asp:Label>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:ListView>
 
                       
                    </div>
                <div>
                       <p style="padding-left:10px">CC:</p> 
            <asp:ListView ID="lstCC" runat="server" ItemPlaceholderID="itemPlaceholder">
    <LayoutTemplate>
        <asp:CheckBox ID="chkuserAll" runat="server" AutoPostBack="true" OnCheckedChanged="chklstccuserAll_CheckedChanged"/>
        Check All<br />
        <hr />
        <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
    </LayoutTemplate>
    <ItemTemplate>
        <table border="0" cellspacing="1" class="displaysmall stylized" cellpadding="0">
            <tr>
                <td  colspan="3">
                    <asp:CheckBox ID="chkUser" runat="server" Text='<%#Eval("UserName")%>'  />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                <td style="width:20px">
                    <asp:Label ID="lblUserID" runat="server" Text='<%#Eval("UserID")%>' Visible="false"></asp:Label>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:ListView>

        
</div>
                </div>
                <div class="popup_Buttons">
                    <asp:Button ID="btnAddSelected" CssClass="active1" runat="server" Text="Add Selected" OnClick="btnAddSelected_Click" CausesValidation="False" />

                    <input id="btnCancel" value="Cancel" type="button" class="active1"  style="border-radius:0 0 0 0;"/>
                    <asp:UpdateProgress ID="uprog1" runat="server" >
                    <ProgressTemplate><img src="img/loadings.gif" alt="" class="popup_loading" /></ProgressTemplate>
                    </asp:UpdateProgress>
                </div>
            </div>
        </asp:Panel>


<cc1:modalpopupextender id="ModalPopupExtender1" runat="server"  BehaviorID="ModalPopupExtender1"
	cancelcontrolid="btnCancel"   
	targetcontrolid="Button1" popupcontrolid="Panel1" 
	popupdraghandlecontrolid="PopupHeader" drag="true" 
	backgroundcssclass="ModalPopupBG">
</cc1:modalpopupextender>
        </ContentTemplate>
        <Triggers><%--
        <asp:PostBackTrigger ControlID="btnAddSelected" />--%>
        </Triggers> 
        </asp:UpdatePanel>
<p style="margin:20px 0 20px 0"><label>subject:</label> <label>  <asp:TextBox ID="txtSubject" Width="500px" runat="server"></asp:TextBox></label></p>
<p style="display:none;"><label>Attachment:</label> <label style="float:left">
  <asp:ListView ID="gvNewFiles" runat="server" ItemPlaceholderID="itemPlaceholder" onitemcommand="gvNewFiles_ItemCommand" >
    <LayoutTemplate>
<div runat="server" id="itemPlaceholder" />

</LayoutTemplate>
    <ItemTemplate>
      <asp:CheckBox ID="chkAttach" runat="server" Checked="true"/>
<asp:LinkButton ToolTip='<%# String.Format("Download {0}",Eval("FileName")) %>' runat="server"
ID="lbtnFiles" Text='<%#Eval("FileName") %>' CommandArgument='<%#Eval("FileName") %>'
CommandName="downloadFile"></asp:LinkButton>
        <br />
    </ItemTemplate> 
        <AlternatingItemTemplate>
      <asp:CheckBox ID="chkAttach" runat="server" Checked="true"/>
<asp:LinkButton ToolTip='<%# String.Format("Download {0}",Eval("FileName")) %>' runat="server"
ID="lbtnFiles" Text='<%#Eval("FileName") %>' CommandArgument='<%#Eval("FileName") %>'
CommandName="downloadFile"></asp:LinkButton>
        <br />
    </AlternatingItemTemplate>
    <EmptyDataTemplate>
<span>No Attachments.</span>
</EmptyDataTemplate>
</asp:ListView></label></p>
<% if (Session[svgDataKey] != null)
   {%>
    <p><label>Attachment: </label><label style="font-size:15px;">
        <asp:LinkButton ID="lnkOpenReviewer" runat="server"  OnClick="lnkOpenReviewer_Click" style="color:blue;">Open With Reviewer</asp:LinkButton></label></p>
        <%} %>
    </div>
<p style="clear:both;display:none;"><label> </label><label> 
    <input class="add" type="button" value="Add Attachment" onclick="AddTextBox()"/></label></p>

</div> 
<div class="mail-msg">
<cc2:Editor ID="txtbody" runat="server" Height="300px"  />
</div>


<div id="divOldMessage" runat="server"></div>
<%--<h1>hi</h1>
<p>thank for writing mail to us. We will work on it.</p>
<label>thank</label>
<label>Gaurav Goel</label>--%>

</div>

</div>
 
 

           <div style="display:none">
<asp:FileUpload ID="sdfsd" runat="server"  />
</div>
          
</asp:Content>

